//
//  NSString+deleteLine.m
//  viviyoo
//
//  Created by Jay_Apple on 15/10/26.
//  Copyright © 2015年 viviyoo. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "NSString+deleteLine.h"
#import "UIColor+HDXColor.h"

@implementation NSString (deleteLine)


/**
 *  构建一个带删除线的属性字符串
 *
 *  @param strText 要加划线的字符串
 *
 *  @return 添加了划线的字符串
 */
+(NSMutableAttributedString*)buildDeleteLineText:(NSString*)strText{
    NSUInteger length = [strText length];
    NSMutableAttributedString *attributeText = [[NSMutableAttributedString alloc] initWithString:strText];
    [attributeText addAttribute:NSStrikethroughStyleAttributeName
                          value:@(NSUnderlinePatternSolid|NSUnderlineStyleSingle)
                          range:NSMakeRange(0, length)];
    [attributeText addAttribute:NSStrikethroughColorAttributeName value:[UIColor colorWithHexString:@"#FFFFFF" alpha:0.4] range:NSMakeRange(0, length)];
    return attributeText;
}

@end
